//
//  XRNetWorkTool.swift
//  MyFood
//
//  Created by dllo on 16/2/17.
//  Copyright © 2016年 XRG. All rights reserved.
//

import UIKit
//
//// 返回数据类型
//enum XRResponseStyle {
//
//case responseJSON, responseString, responseData
//
//}

typealias Success = (result:String)->Void
typealias Error = (error:String)->Void

class XRNetWorkTool: NSObject {

//    class func post(url:String!,body:[String:AnyObject]? = nil, header:[String : String]? = nil, success:Success ,error:Error) {
//
//    
//        Alamofire.request(.POST, url, parameters: body, encoding:.JSON, headers: header).validate().responseString { response in
//
////            print(response)
////            response.result.error
//            if (isSuccess(response.result)) {
//                success(result: response.result.value!)
//            }else{
//                print("networking error : \(response.result.error)")
//                success(result: "")
//            }
//        }
//    }
//
//    class func get(url:String!,header:Dictionary<String,String>,success:Success,error:Error) {
//        Alamofire.request(.GET, url, parameters: nil, encoding: .JSON, headers: header).validate().responseString { (response) -> Void in
//            if (isSuccess(response.result)) {
//                success(result: response.result.value!)
//            }else{
//                print("networking error : \(response.result.error)")
//                success(result: "")
//            }
//        }
//    }
//
//    class func isSuccess(result: Result<String, NSError>) -> Bool {
//        if (result.error != nil) {
//            return false
//        }
//        return true
//    }



}
